<html lang="zh-CN">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>搜索结果</title>
<meta name="viewport" content=" initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
	<link href="{$Think.config.RESOURCEURL}wx_assets/css/common.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
	<link href="{$Think.config.RESOURCEURL}wx_assets/css/iconfont/font_tuan.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.1.1.3.min.js{$Think.config.RESOURCE_VER}"></script>
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.alert.js{$Think.config.RESOURCE_VER}"></script>
	<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/wx_share.js{$Think.config.RESOURCE_VER}"></script>
	<script src="{$Think.config.RESOURCEURL}wx_assets/js/util.js{$Think.config.RESOURCE_VER}"></script>
<script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/share_product.js{$Think.config.RESOURCE_VER}"></script>
	<if condition="$mallHue.mallHue eq '1'">
		<link href="{$Think.config.RESOURCEURL}wx_assets/css/product/product_yxds_index_blue.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="{$Think.config.RESOURCEURL}wx_assets/css/product_list_blue.css{$Think.config.RESOURCE_VER}">
		<else/>
		<link href="{$Think.config.RESOURCEURL}wx_assets/css/product/product_yxds_index.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="{$Think.config.RESOURCEURL}wx_assets/css/product_list.css{$Think.config.RESOURCE_VER}">
	</if>
	<script src="{$Think.config.RESOURCEURL}wx_assets/js/product/timer.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
	<script src="{$Think.config.RESOURCEURL}wx_assets/js/vue.min.js{$Think.config.RESOURCE_VER}"></script>
</head>
<style>
	@font-face {
		  font-family: 'iconfont';
		  src: url('//at.alicdn.com/t/font_1464436201_1620708.eot'); /* IE9*/
		  src: url('//at.alicdn.com/t/font_1464436201_1620708.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
		  url('//at.alicdn.com/t/font_1464436201_1620708.woff') format('woff'), /* chrome、firefox */
		  url('//at.alicdn.com/t/font_1464436201_1620708.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
		  url('//at.alicdn.com/t/font_1464436201_1620708.svg#iconfont') format('svg'); /* iOS 4.1- */
	}
	.order-search {
    height: 1.7rem;
    margin: 10px;
   
    text-align: center;  
    position: relative;    
   
   
                                             
}
.searchicon
{
	color: #ccc;
    font-size: 0.8rem;
    font-family: "iconfont";
    float: left;
    line-height: 1.7rem;
    position: absolute;
	left: .5rem;
}
.order-search > div
{
	margin-right: 2rem;   
	position: relative;
	height: 100%;
	background-color: white;
	border: 1px solid #eee;
}
.order-search > div > input {
    height: 100%;
    font-size: 13px;
    box-sizing: border-box;
    width: 100%;
    padding-left: 2rem;
    padding-right: 0.2rem;
}
.order-search  > a
{
	position: absolute;
	top: 0px;
	right: 0px;
	font-size: .75rem;
	display: block;
	height: 100%;
	line-height: 1.7rem;
}
</style>
<body>
<if condition="$selfInfo.subscribe eq '0'">
	<div class="careview">
		<img src="{$mallInfo.logo}" alt="" />
		<a href='{$mallInfo.wechaturl}'>立即关注</a>
		<empty name="mallInfo.recommend">
			<p>{$mallInfo.wechatname}</p>
			<else />
			<p>{$mallInfo.recommend}</p>
		</empty>
		<span></span>
	</div>
	<script>
		$('.careview > span').on('click',function(){
			$('.careview').hide();
		});
	</script>
</if>
<form>
	<div class="order-search" style="height: 34px;">
		<div>
		<i style="line-height: 34px;" class="searchicon">&#xe61a;</i>
		<input onkeypress="listenInput(event)" autocomplete="off"  type="search" id="search" placeholder="输入商品名" value="{$keyword}">
		</div>
		<a style="line-height: 34px;" onclick="submitSearch()">搜索</a>
	</div>
</form>
<div class="lay_page page_cat_1">
	<div class="lay_page_wrap">
       <div class="fn_goods qb_clearfix" id="pInfo" v-show="show" style="display: none;">
                <ul id="show_container">
                    <li v-for="product in sr.productList">
                    	<a onclick="onDetail({{product.id}})">
                    		<div class="imgDiv">
								<img v-bind:src="product.picUrl+'?x-oss-process=image/resize,w_200,h_200,m_mfit,x-oss-process=image/crop,w_200,h_200,g_nw'" class="default">
								<div class="soldOut" v-if="product.inventory=='1'&&product.inventoryCount<=0">已抢完</div>
								<div class="seckillTime" v-if="product.playType == 4&&product.seckillIsEnd!=1&&product.seckillIsStart ==1" >
									<template v-if="product.seckillIsEnd!=1">
										<p style="text-align: center;" >
											<template v-if="product.seckillIsStart ==1">
												<i  class="lxftime" nowtime="{{product.nowTime}}" endtime="{{product.seckillEndTime}}" col="0" lxfday="no" lxftext="距结束"></i>
											</template>
											<i class="lxftime" v-else nowtime="{{product.nowTime}}" endtime="{{product.seckillStartTime}}" col="0" lxfday="no" lxftext="距开始"></i>
										</p>
									</template>
									<p v-else style="text-align: center;">
									   已抢完
									</p>
								</div>
								<div class="seckill_right_top" v-if="product.playType == 4"></div>
								<div class="taggroup" v-else>
									<span v-for="v in product.picTag">
										<p>{{v}}</p>
										<if condition="$mallHue.mallHue eq '1'">
											<i><img class="tagImg" v-bind:src="resUrl+'wx_assets/images/product/tag_blue.png'+ver" alt="" /></i>
											<else/>
											<i><img class="tagImg" v-bind:src="resUrl+'wx_assets/indiana/images/tag.png'+ver" alt="" /></i>
										</if>

									</span>
								</div>
							</div>
							<div class="goods_name qb_fs_s mod_color_weak">
								<span class="playTag" v-if="product.teambuy != '1'&&product.freeBuy == '1'">我要代言</span>
								<span class="playTag" v-if="product.teambuy != '1'&&product.freeBuy != '1'&&product.playType == '3'">夺宝</span>
								{{product.name}}
							</div>
							
							<div class="price qb_fs_s" v-if="product.teambuy == '1'">
								<span class="mod_color_strong">&yen;{{product.teamPrice}}</span>
								<del>&yen;{{product.fixedPrice}}</del>
							</div>
							<template v-else >
								<div class="price" v-if="product.playType == '3'">
									<div class="indianaInfo">
										<div class="bar">
											<span style="width:{{product.barProgress}}"></span>
										</div>
										<span v-if="pitem.moduleType == 'two'" style="font-size:12px;display:block;">开奖进度<span style="color:#009ddf">{{product.barProgress}}</span></span>
										<div class="partakeCount" v-else >
												<span>总需{{product.totalCopies}}人次</span>
												<span>剩余{{product.beenSold}}</span>
										</div>
									</div>
								</div>
								<template v-else>
									<div class="price qb_fs_s" v-if="product.freeBuy == '1'">
										<!--小白龙协助-->
										<span class="mod_color_strong">&yen;{{product.freeBuyMoney | freebuymoney}}</span>
									</div>
									<template v-else>
										<template v-if="product.playType == '5' && sr.isEnjoyMiPrice == '1'">
											<div class="price qb_fs_s" v-if="product.supportSpecification == '1'">
												密友价:<span class="mod_color_strong">￥{{product.minMiPrice}}</span>
											</div>
											<div class="price qb_fs_s" v-else>
												密友价:<span class="mod_color_strong">￥{{product.miPrice}}</span>
											</div>
										</template>
										<template v-else>
											<template v-if="product.playType == '6'">
												<div class="price qb_fs_s indianaInfo" style="height:32px;float:none;box-sizing:border-box">
													<div class="bar">
														<span style="width:{{product.barProgress}}"></span>
													</div>
													<div class="crowdInfo">
														<span style='margin:0;'>{{product.barProgress}}</span>
														<span style='margin:0;'>{{product.supportPerson}}人支持</span>
														<span style='margin:0;'>剩余<span style='color:#D5182C'>{{product.day}}</span>天</span>
													</div>
												</div>
											</template>
											<template v-else>
												<template v-if="product.supportSpecification == '1'">
													<div class="price qb_fs_s" v-if="product.minDisPrice > 0">
														<span class="mod_color_strong">&yen;{{product.minDisPrice}}</span>
														<del>&yen;{{product.maxFixedPrice}}</del>
													</div>
													<template v-else>
														<div class="price qb_fs_s">
															<span class="mod_color_strong">&yen;{{product.minFixedPrice}}</span>
														</div>
													</template>
												</template>
												<template v-else>
													<div class="price qb_fs_s" v-if="product.discountedPrice">
														<span class="mod_color_strong">&yen;{{product.discountedPrice}}</span>
														<del>&yen;{{product.fixedPrice}}</del>
													</div>
													<div v-else class="price qb_fs_s"><span class="mod_color_strong">&yen;{{product.fixedPrice}}</span></div>
												</template>
											</template>
										</template>
									</template>
								</template>
							</template>
                    	</a>
                    </li>
                </ul>
       <div style="width: 100%;float:left;height: 40px;line-height: 40px;text-align: center;color:#777;">{{loadText}}</div>
       </div>
	</div>
</div>

<!--THINKPHP部分-->


<a id="car" class="car" onclick="product.goCart()">
	<i class="iconfont">&#xe608;</i>
		<span>
			<p id="carNum"></p>
		</span>
</a>
<div class="qb_quick_tip qb_none" id="bubble"></div>
<script>
var hrefParamsArray = GetSessionIdFromHref(window.location.search);
hrefParamsArray["userName"]='{$userName}';
var baseUrl = '{$Think.config.SERVER_HOST}';
var customerId=$.util.getParam("customerId");
var hrefPath = baseUrl+'call.html?customerId='+customerId;

function goSearch(){
	window.location.href=hrefPath+'&module=product&method=toSearch';
}

function GetSessionIdFromHref(search){
　　	var args = search.substring(1); 
　　	var retval = new Array(); 
	args = args.split("&"); 
		for(var i = 0; i < args.length; i ++){ 
			str = args[i]; 
			var arg = str.split("="); 
			if(arg.length <= 1) continue; 
			
			if(arg[0] == 'params') {
				var params = decodeURIComponent(arg[1]);
				var obj = eval('(' + params + ')');
				if (obj.keyword != undefined) {
					retval["keyword"] = obj.keyword;
				}
				if (obj.qId != undefined) {
					retval["qId"] = obj.qId;
				}
				if (obj.miUId != undefined) {
					retval["miUId"] = obj.miUId;
				}
				retval["id"] = obj.id;
			} else if(arg[0] == 'customerId') {
				retval["customerId"] = arg[1]; 
			}else if(arg[0] == 'userName'){
				retval["userName"] = arg[1]; 
			} else if(arg[0] == 'method') {
				retval["method"] = arg[1];
			} else if (arg[0] == 'module') {
				retval["module"] = arg[1];
			}
		} 
		
		if (retval["start"] == undefined) {
			retval["start"] = 0;
		}
		return retval; 
}
function onDetail(id) {
	var rootid=hrefParamsArray["rootid"];
    var pageUrl="";
    var p=$.util.getParamAsObject();
			var mallQId = "{$quanInfo.qId}";
			var mallUId = "{$quanInfo.uId}";
			if((p&& p.qId)||(mallQId&&mallUId)){
				var params={
					"id":id,
					"miUId": p.miUId||mallUId,
					"qId": p.qId||mallQId,
					"fromGuid":p.fromGuid
				}
			}else{
				var params={
					"id":id
				}
			}
    if(rootid){
        params["rootid"]=rootid;
    }
    params=encodeURIComponent(JSON.stringify(params));
    pageUrl=baseUrl+'call.html?customerId={$customerId}&module=product&method=getProduct&params='+params;
    location.href= pageUrl;
}
</script>
<script>
	
//文档的总高度
function getScrollHeight() {
		var scrollHeight = 0,
			bodyScrollHeight = 0,
			documentScrollHeight = 0;
		if (document.body) {
			bodyScrollHeight = document.body.scrollHeight;
		}
		if (document.documentElement) {
			documentScrollHeight = document.documentElement.scrollHeight;
		}
		scrollHeight = (bodyScrollHeight - documentScrollHeight > 0) ? bodyScrollHeight : documentScrollHeight;
		return scrollHeight;
	}

function getWindowHeight() {
		var windowHeight = 0;
		if (document.compatMode == "CSS1Compat") {
			windowHeight = document.documentElement.clientHeight;
		} else {
			windowHeight = document.body.clientHeight;
		}
		return windowHeight;
	}

function getScrollTop() {
	var scrollTop = 0,
		bodyScrollTop = 0,
		documentScrollTop = 0;
	if (document.body) {
		bodyScrollTop = document.body.scrollTop;
	}
	if (document.documentElement) {
		documentScrollTop = document.documentElement.scrollTop;
	}
	scrollTop = (bodyScrollTop - documentScrollTop > 0) ? bodyScrollTop : documentScrollTop;
	return scrollTop;
}


	
</script>
<script type="text/javascript">
	var shareUrl = '',defaultlimit=20,keyword=hrefParamsArray["keyword"];
	wx_share.init({
		"title":"{$tagInfo.title}",
		"desc":"{$tagInfo.description}",
		"imgUrl":"{$tagInfo.picUrl}",
		"link":shareUrl,
		"pkg":{
			"appId": '{$pkg.appId}',
			"timestamp": '{$pkg.timestamp}',
			"nonceStr": '{$pkg.nonceStr}',
			"signature": '{$pkg.signature}'
		},
		success:function(config,shareType){

		}
	});
	
	var searchResult={
		vm:null,
		start:0,
		limit:defaultlimit,
		listData:null,
		allowload:true,
		_init:function(){
			var me=this;
			me.scrollBy();
			Vue.filter('freebuymoney', function (value) {
				/**
				 * 修改概述: value为空, 导致split报错, 在商城搜索功能中, 导致搜索(e.g.伊思)结果不显示
				 * 如果为空, 则直接返回, 否则下面的split会导致js报错
				 * 不知道会不会影响其他功能
				 * @modify lilei<LL_strive@163.com> 2017-05-12
				 */
				if (value == null) {
					return;
				}

			  var arr=value.split(','),
			  	  len=arr.length;
			  if(len>1)
			  {
			  	return arr[0]+'~'+arr[len-1]
			  }
			  else
			  {
			  	return arr[0]
			  }
			})
			
			me.vm=new Vue({
				el:'#pInfo',
				data:{
					show:false,
				    sr:'',
				    ver:'{$Think.config.RESOURCE_VER}',
				    resUrl:'{$Think.config.RESOURCEURL}',
				    loadText:'下拉加载更多'
				},
				ready:function(){
					me._getJSON(keyword);
				}
			});
			me.vm.$watch('sr',function(){
				lxfEndtime();
			})
		},
		_getJSON:function(keyword,isrebuild){
			var me=this;
			if($("#pageLoading").length&&!$("#pageLoading").is(":hidden")){
				return;
			}
			if(isrebuild)
			{
				me.allowload=true;
				me.listData=null;
				me.vm.$set('loadText','下拉加载更多');
			}
			var params={
				"keyword":keyword,
				"qId":hrefParamsArray["qId"]?hrefParamsArray["qId"]:'',
				"miUId":hrefParamsArray["miUId"]?hrefParamsArray["miUId"]:'',
				"start":me.start,
				"limit":me.limit
			}
			params=encodeURIComponent(JSON.stringify(params));
			console.log(params);
			$.ajax({
				url:baseUrl+'call.json?customerId={$customerId}&module=product&method=searchResults&params='+params,
				type:'GET',
				dataType:'JSON',
				beforeSend:function(){
					$.util.pageLoading.show('正在加载')
				},
				success:function(data){
					if(data===Object){}
					else
					{
						data=eval('('+data+')');
					}
					//第一次加载
					if(!me.listData)
					{
						me.listData=data;
						if(!data.productList||data.productList.length<defaultlimit)
						{
							me.allowload=false;
						    me.vm.$set('loadText','没有更多数据');
						}
					}
					//第二次加载
					else if(data.productList)
					{
						
						for(var i=0;i<data.productList.length;i++)
						{
								me.listData.productList.push(data.productList[i]);
						}
					}
					else
					{
						me.allowload=false;
						me.vm.$set('loadText','没有更多数据');
					}
					
					me.start=me.start+me.limit;
					me.vm.$set('sr',me.listData);
					me.vm.$set('show',true);
					$.util.pageLoading.hide();
					
					
				}
			})
		},
		scrollBy:function(){
			var me=this;
			window.onscroll = function(){
				if(getScrollTop() + getWindowHeight() == getScrollHeight()&&getScrollTop()!=0)
				{
					if(me.allowload)
					{
						
						me._getJSON(keyword);
					}
					
				}
			}
		}
	}
	var submitSearch=function(){
		var v=document.getElementById('search').value;
		searchResult.start=0;
		searchResult.limit=defaultlimit;
		searchResult._getJSON(v,true);
		keyword=v;
	}
	var listenInput=function(event){
			var v=document.getElementById('search').value;
			var e = event||window.event; 
				if(e.keyCode=='13')
				{
					
					e.preventDefault();
					
						searchResult.start=0;
						searchResult.limit=defaultlimit;
						searchResult._getJSON(v,true);
						keyword=v;
//						var qId=hrefParamsArray["qId"]?hrefParamsArray["qId"]:'',
//							miUId=hrefParamsArray["miUId"]?hrefParamsArray["miUId"]:'';
//							
//					 	window.location.href='call.html?customerId={$customerId}&module=product&method=searchProduct&params=%7B%22keyword%22:%22'+v+'%22,%22qId%22:%22'+qId+'%22,%22miUId%22:%22'+miUId+'%22%7D';
				}
		}
	searchResult._init();
	
</script>

</body>
</html>